
<?php
//模块插件类
//对外接口函数类，其他插件可通过“$this->plugin('jy_faceocr')->方法名” 来调用本类的方法
defined('BY_JYA') or exit('error');
class func_jy_juheapi extends plugin{
	//天气
	public function weather($cityname,$format){
		$setting=$this->get_setting();
		$key=$setting['key'];
		$cityname=urlencode($cityname);
		$url = 'https://api.om.qq.com/article/clientpublive?key='.$key.'&format='.$format.'&cityname='.$cityname;
		$data = cfc('http')->ihttp_request($url);
		return $data; 
	}
	//星座运势
	public function constellation($consname,$type){
		$setting=$this->get_setting();
		$key=$setting['key'];
		$consname=urlencode($consname);
		$url = 'http://web.juhe.cn:8080/constellation/getAll?key='.$key.'&consname='.$consname.'&type='.$type;
		$data = cfc('http')->ihttp_request($url);
		return $data; 
	}
	//快递查询
	public function express($com,$no){
		$setting=$this->get_setting();
		$key=$setting['key'];
		$url = 'http://v.juhe.cn/exp/index?key='.$key.'&com='.$com.'&no='.$no;
		$data = cfc('http')->ihttp_request($url);
		return $data; 
	}
	//定火车票
	public function tickets($stationName){
		$setting=$this->get_setting();
		$key=$setting['key'];
		$url = 'http://op.juhe.cn/trainTickets/cityCode?key='.$key.'&stationName='.$stationName;
		$data = cfc('http')->ihttp_request($url);
		return $data; 
	}
	//全国省市今日油价
	public function oil(){
		$setting=$this->get_setting();
		$key=$setting['key'];
		$url = 'http://apis.juhe.cn/cnoil/oil_city?key='.$key;
		$data = cfc('http')->ihttp_request($url);
		return $data; 
	}	
}
?>
